<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('风控结果表列表')"/>
    <th:block th:include="include :: select2-css" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <!--                            <li>-->
                        <!--                                <label>信息ID：</label>-->
                        <!--                                <input type="text" name="baseId"/>-->
                        <!--                            </li>-->
                       <!-- <li>
                            <label>任务ID：</label>
                            <input type="text" name="taskId"/>
                        </li>-->
                        <!--    <li>
                                <label>配置ID：</label>
                                <input type="text" name="configId"/>
                            </li>-->
                        <li>
                            <label>商户名称：</label>
                            <select name="dataId" class="form-control">
                                <option value="">所有</option>
                                <option  th:each="item:${riskBaseInfoList}" th:text="${item.name}" th:value="${item.dataId}"></option>
                            </select>
                        </li>


                        <li>
                            <label>用户ID：</label>
                            <input type="text" name="uid"/>
                        </li>
                        <!-- <li>
                             <label>用户名称：</label>
                             <input type="text" name="username"/>
                         </li>-->
                        <!--  <li>
                              <label>手机号：</label>
                              <input type="text" name="mobile"/>
                          </li>-->
                        <li>
                            <label>风控结果：</label>
                            <input type="text" name="message"/>
                        </li>
                        <li>
                            <label>风控状态：</label>
                            <select name="status">
                                <option value="">所有</option>
                                <option value="1">成功</option>
                                <option value="0">失败</option>
                            </select>
                        </li>
                        <li>
                            <label>日期：</label>
                            <input type="text" id="dateInfo" name="dateInfo" autocomplete="off"/>
                        </li>


                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i
                                    class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i
                                    class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <!--            <div class="btn-group-sm" id="toolbar" role="group">-->
        <!--                <a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="risk:resultInfo:add">-->
        <!--                    <i class="fa fa-plus"></i> 添加-->
        <!--                </a>-->
        <!--                <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="risk:resultInfo:edit">-->
        <!--                    <i class="fa fa-edit"></i> 修改-->
        <!--                </a>-->
        <!--                <a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="risk:resultInfo:remove">-->
        <!--                    <i class="fa fa-remove"></i> 删除-->
        <!--                </a>-->
        <!--                <a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="risk:resultInfo:export">-->
        <!--                    <i class="fa fa-download"></i> 导出-->
        <!--                </a>-->
        <!--            </div>-->
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('risk:resultInfo:edit')}]];
    var removeFlag = [[${@permission.hasPermi('risk:resultInfo:remove')}]];
    var prefix = ctx + "risk/resultInfo";
    var prefixView = ctx + "member/info/view/";

    $(function () {
        var options = {
            url: prefix + "/list",
            createUrl: prefix + "/add",
            updateUrl: prefix + "/edit/{id}",
            removeUrl: prefix + "/remove",
            exportUrl: prefix + "/export",
            modalName: "风控结果表",
            columns: [
                //     {
                //     checkbox: true
                // },
                {
                    field: 'id',
                    title: 'ID'
                },
                // {
                //     field: 'baseId',
                //     title: '信息ID'
                // },
                // {
                //     field: 'taskId',
                //     title: '任务ID'
                // },
                // {
                //     field: 'configId',
                //    title: '配置ID'
                //},
                // {
                //     field: 'dataId',
                //     title: '商户ID'
                // },
                {
                    field: 'name',
                    title: '商户名称'
                },
                // {
                //     field: 'dataType',
                //     title: '商户类型'
                // },
                {
                    field: 'uid',
                    title: '用户ID',
                    formatter: function (value,row,index){
                        var result = '<span style="color: #1c84c6; border-bottom: 1px solid " onclick="memberInfoView(\''+row.uid+'\')">'+row.uid+'</span>';
                        return result;
                    }
                },
                // {
                //     field: 'username',
                //     title: '用户名称'
                // },
                // {
                //     field: 'mobile',
                //     title: '手机号'
                // },
                // {
                //     field: 'idcard',
                //     title: '身份证号'
                // },
                {
                    field: 'status',
                    title: '风控状态',
                    formatter: function (value, row) {
                        if (value === 1) {
                            return '成功';
                        } else if (value === 0) {
                            return '失败';
                        } else {
                            return '';
                        }
                    }
                },

                // {
                //     field: 'result',
                //     title: ''
                // },
                {
                    field: 'code',
                    title: '返回码'
                },
                {
                    field: 'message',
                    title: '风控结果'
                },
                {
                    field: 'createTime',
                    title: '时间'
                },
                // {
                //     field: 'paramInfo',
                //     title: ''
                // },
                // {
                //     field: 'resultInfo',
                //     title: ''
                // },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        // actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    });

    layui.use('laydate', function(){
        var laydate = layui.laydate;

        laydate.render({
            elem: '#dateInfo',
            type: 'date',
            range: '~'
            // ,min: -7 //7天前
            ,max: 0
        });

    });

    function memberInfoView(uid){
        var url = prefixView + uid;
        $.modal.open('用户详情', url);
    }

</script>
</body>
</html>